/**
 * Project configuration types
 */

export interface BaseComponent {
  name: string;
  description: string;
  required: boolean;
  version: string;
}

export interface ProjectDirectoryNode {
  name: string;
  description?: string;
  files?: string[];
  children?: ProjectDirectoryNode[];
}

export interface ProjectConfig {
  projectName: string;          // Project name input
  projectType: string;         // Dynamic project type dropdown selection
  description: string;         // Project description textarea
  uiFramework: string;        // UI framework radio group (Vue/React)
  language: string;           // Programming language: typescript | javascript
  buildTool: string;          // Build tool: vite | webpack
  targetPlatform: string;     // Target platform 单选: pc | app | miniprogram
  maxLevels: number;          // Menu maximum level number input
  baseComponents: string[];   // Selected base components array
  requirementDescription?: string; // 项目功能需求描述（用于后端分析）
  extendedComponents?: string[]; // 由后端建议/用户选择的扩展组件
  customRequirements: string; // Custom requirements textarea
  
  // 新增架构配置字段
  devProxy?: string;          // 开发环境API代理
  testProxy?: string;         // 测试环境API代理
  prodProxy?: string;         // 生产环境API代理
  stateManagement?: string;   // 状态管理方案
  router?: string;            // 路由方案
  layout?: string;            // 布局类型
  initialComponents?: string[]; // 初始组件选择
  apiTools?: string[];        // API工具选择
  additionalConfig?: string;  // 额外配置描述
  directoryStructure?: ProjectDirectoryNode[]; // 生成的目录结构（可选）

  // 新增：组件生成（如登录、菜单等）
  generatedComponents?: string[]; // 组件生成选项：['login', 'menu', ...]
}

export interface ProjectTypeOption {
  id: string;
  name: string;
  description?: string;
}

export interface UIFrameworkOption {
  id: string;
  name: string;
  value: string;
  icon?: string;
}

export interface LanguageOption {
  code: string;
  name: string;
}

export interface ProjectConfigState {
  config: ProjectConfig;
  projectTypes: ProjectTypeOption[];
  uiFrameworks: UIFrameworkOption[];
  baseComponents: BaseComponent[];
  suggestedComponents: BaseComponent[];
  directoryStructure: ProjectDirectoryNode[];
  directorySummary: string;
  structureLoading: boolean;
  structureError: string | null;
  languages: LanguageOption[];
  loading: boolean;
  error: string | null;
  isConfigured: boolean;
}